package com.atguigu.gmall.order.controller;


import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.order.OrderInfo;
import com.atguigu.gmall.order.biz.service.OrderSeckillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/api/inner/order")
@RestController
public class OrderSeckillController {


    @Autowired
    OrderSeckillService orderSeckillService;

    @GetMapping("/seckill/order")
    public Result<OrderInfo> getSeckillOrderInfo(
            @RequestParam("code") String code,
            @RequestParam("skuId") Long skuId){

        //查出秒杀单
       OrderInfo orderInfo = orderSeckillService.getSeckillOrder(code,skuId);
        return Result.ok(orderInfo);
    }
}
